 <?php
 
    class Mp3_InfoCanco{
		public $titol;
		public $tamany;
		public $artista;
		public $sortname;
		public $nomAlbum;
		public $status;
		public $data;
		public $pais;
		public $arxiu;
		
		public function __construct(){
		}
		
		public function llegir($xml) 
		{
			foreach ( $xml AS $tag => $child )	{
				switch($tag) {
					
					case 'title':
						$this->titol=$child;
						break;
					case 'length':
						$this->tamany=$child;
						break;
					case 'artist-credit':
						$xml2 = $child->children()->children()->children();
						foreach ( $xml2 AS $tag2 => $child2 )	{
							if ($tag2 == 'name') {
								$this->artista=$child2;
							} else if ($tag2 == 'sort-name'){
								$this->sortname=$child2;
							}
						}
						break;
					case 'release-list':
						$xml2=$child->children()->children();
						foreach ( $xml2 AS $tag2 => $child2 )	{
							switch($tag2) {
								case 'title':
									$this->nomAlbum=$child2;
									break;
								case 'status':
									$this->status=$child2;
									break;
								case 'status':
									$this->status=$child2;
									break;
								case 'date':
									$this->data=$child2;
									break;
								case 'country':
									$this->pais=$child2;
									break;
							}
						}
						break;
				}
			}	 
		}
	}
  